#include <iostream>
#include <algorithm>

using namespace std;

// Q1. 用特殊操作处理字符串 I©leetcode
// https://leetcode.cn/contest/weekly-contest-458/problems/process-string-with-special-operations-i/description/

class Solution
{
public:
    string processStr(string s)
    {
        string ans;
        for (int i = 0; i < s.size(); i++)
        {
            if (s[i] == '*')
            {
                if (ans.size() > 0)
                {
                    ans.pop_back();
                }
            }
            else if (s[i] == '#')
            {
                ans += ans;
            }
            else if (s[i] == '%')
            {
                reverse(ans.begin(), ans.end());
            }
            else
            {
                ans += s[i];
            }
        }
        return ans;
    }
};

int main()
{
    return 0;
}